<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
session_start();
if(!empty($_GET['q'])){
    include_once( 'config.php' );
    include_once( 'weibooauth.php' );


    $c = new WeiboClient( WB_AKEY , WB_SKEY ,  token_key, token_secret);
    $ms  = $c->home_timeline(); // done
    $me = $c->verify_credentials();
    $text   = base64_decode($_GET['q']);
    $result = $c->update($text);
    if(array_key_exists('text', $result)){
        $url    = str_replace('http://t.cn/', '', $result['text']);
        echo $url;
    }
}
?>
